package cn.neusoft.utils;

import java.io.*;

public class IOUtils {

    public static String readStr(InputStream inputStream){
        //声明StringBuilder  作用是把读到的字符串串联起来
        StringBuilder sb = new StringBuilder();
        //将字节流转换成字符流  字符流再转成缓冲流 可以直接读一行
        BufferedReader bufferedReader = null;
        try {
            bufferedReader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
            String s = null;
            while ((s = bufferedReader.readLine())!=null){
                sb.append(s);
            }
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

        return sb.toString();
    }

}
